package com.jah.picavue.client.events;


import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.jah.picavue.client.model.User;

public class AlbumSelectionEvent extends
		GwtEvent<AlbumSelectionEvent.Handler> {
	/**
	 * Interface to describe this event. Handlers must implement.
	 */
	public interface Handler extends EventHandler {
		public void onAlbumSelected(AlbumSelectionEvent p);
	}

	@Override
	protected void dispatch(AlbumSelectionEvent.Handler handler) {
		handler.onAlbumSelected(this);
	}

	@Override
	public GwtEvent.Type<AlbumSelectionEvent.Handler> getAssociatedType() {
		return TYPE;
	}

	public static final GwtEvent.Type<AlbumSelectionEvent.Handler> TYPE = new GwtEvent.Type<AlbumSelectionEvent.Handler>();

	private String selectedAlbumID;
	private String view;
	private User u = User.INSTANCE;

	public String getSelectedAlbumID() {
		return selectedAlbumID;
	}

	public void setSelectedAlbumID(String id) {
		if (!u.isAlbum(id)) id = null;
		this.selectedAlbumID = id;
	}

	public String getView() {
		return view;
	}

	public void setView(String view) {
		this.view = view;
	}
}